package com.ruicar.afs.cloud.admin.config;

import com.ruicar.afs.cloud.common.core.util.RsaUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


import lombok.Data;

/**
 * The type RsaConfiguration.
 * <p>
 * Created on 2019-02-18
 *
 * @author Fzero
 */
@Data
@Component
public class RsaConfiguration implements InitializingBean {
	/**
	 * The Rsa private.
	 */
	@Value(value = "${security.encode.rsapri}")
	private String rsaPrivate;
	/**
	 * The Rsa public.
	 */
	@Value(value = "${security.encode.rsapub}")
	private String rsaPublic;

	@Override
	public void afterPropertiesSet() throws Exception {
		RsaUtils.KeyHolder.privateKey = rsaPrivate;
		RsaUtils.KeyHolder.publicKey = rsaPublic;
	}
}
